<?php defined('IN_ADMIN') or exit('No permission resources.');?>
<?php include $this->admin_tpl('header', 'admin');?>
<script type="text/javascript">
$(document).ready(function() {
	$.formValidator.initConfig({
		formid: "myform",
		autotip: true,
		onerror: function(msg, obj) {
			window.top.art.dialog({
				content: msg,
				lock: true,
				width: '200',
				height: '50'
			})
		}
	});
	$("#name").formValidator({
		onshow: "<?php echo L('input').L($column.'_name')?>",
		onfocus: "<?php echo L('input').L($column.'_name')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_name')?>"
	});
	$("#full_name").formValidator({
		onshow: "<?php echo L('input').L($column.'_full_name')?>",
		onfocus: "<?php echo L('input').L($column.'_full_name')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_full_name')?>"
	});

	$("#image_square").formValidator({
		onshow: "<?php echo L('input').L($column.'_image_square')?>",
		onfocus: "<?php echo L('input').L($column.'_image_square')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_image_square')?>"
	});

	$("#description").formValidator({
		onshow: "<?php echo L('input').L($column.'_description')?>",
		onfocus: "<?php echo L('input').L($column.'_description')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_description')?>"
	});

	$("#agency_type").formValidator({
		onshow: "<?php echo L('input').L($column.'_type')?>",
		onfocus: "<?php echo L('input').L($column.'_type')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_type')?>"
	});

	$("#agency_branch").formValidator({
		onshow: "<?php echo L('input').L($column.'_branch')?>",
		onfocus: "<?php echo L('input').L($column.'_branch')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_branch')?>"
	});

	$("#description").formValidator({
		onshow: "<?php echo L('input').L($column.'_description')?>",
		onfocus: "<?php echo L('input').L($column.'_description')?>"
	}).inputValidator({
		min: 1,
		onerror: "<?php echo L('input').L($column.'_description')?>"
	});
	//鼠标失去焦点事件
    $("#website").blur(function(){
    	var tmpData = "";
    	tmpData = $("#website").val();//获取输入框里的值
    	var pattern = /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/;
    	if(tmpData.length != 0){
    		if(!pattern.test(tmpData)){
    			$('#wsite_reminder').css('display','block');
       		}else{
       			$('#wsite_reminder').css('display','none');
           	}
    	}
    })
	//鼠标失去焦点事件
    $("#sign_website").blur(function(){
    	var tmpData = "";
    	tmpData = $("#sign_website").val();//获取输入框里的值
    	var pattern = /^((https|http|ftp|rtsp|mms)?:\/\/)[^\s]+/;
    	if(tmpData.length != 0){
    		if(!pattern.test(tmpData)){
    			$('#ssite_reminder').css('display','block');
       		}else{
       			$('#ssite_reminder').css('display','none');
           	}
    	}
    })
	//鼠标失去焦点事件
    $("#contact_tel").blur(function(){
    	var tmpData = "";
    	tmpData = $("#contact_tel").val();//获取输入框里的值
    	var pattern1 =  /0?(13|14|15|17|18)[0-9]{9}/;
    	var pattern2 =   /[0-9-()（）]{7,18}/;
    	if(tmpData.length != 0){
    		if(!pattern1.test(tmpData) || !pattern2.test(tmpData)){
    			$('#ctel_reminder').css('display','block');
       		}else{
       			$('#ctel_reminder').css('display','none');
           	}
    	}
    })
	//鼠标失去焦点事件
    $("#sign_tel").blur(function(){
    	var tmpData = "";
    	tmpData = $("#sign_tel").val();//获取输入框里的值
    	var pattern1 =  /0?(13|14|15|17|18)[0-9]{9}/;
    	var pattern2 =   /[0-9-()（）]{7,18}/;
    	if(tmpData.length != 0){
    		if(!pattern1.test(tmpData) || !pattern2.test(tmpData)){
    			$('#stel_reminder').css('display','block');
       		}else{
       			$('#stel_reminder').css('display','none');
           	}
    	}
    })

});
</script>
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
	   <a href="./index.php?m=agency&c=manage&a=init" style="font-size:14px;color: #0000FF;font-weight:bolder;"><em>返回上一级</em></a>	
	</div>
</div>
<div class="pad-10">

	<form name="myform" action="?m=<?php echo ROUTE_M?>&c=<?php echo ROUTE_C?>&a=<?php echo ROUTE_A?>&id=<?=$id?>" method="post"
		id="myform" enctype="multipart/form-data">
		<div class="content pad-10" id="show_div_1" style="height: auto">
			<fieldset>
				<legend>机构信息---编辑</legend>
				<table width="100%" class="table_form">
					<tr>
						<td width="120"><?php echo L($column.'_name')?>：</td>
						<td><input type="text" name="data[name]" id="name"
							class="input-text" value="<?= isset($data['name'])?$data['name']:""?>" /></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_full_name')?>：</td>
						<td ><input type="text" id="full_name" class="input-text"
									name="data[full_name]"  value="<?= isset($data['full_name'])?$data['full_name']:""?>"   /></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_website')?>：</td>
						<td ><input type="text" id="website" class="input-text"
									name="data[website]"   value="<?= isset($data['website'])?$data['website']:""?>"  /><span id="wsite_reminder" style="color: red;display:none;">请按照：http://www.qq.com 格式输入！</span></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_branch')?>：</td>
						<td ><select name="data[branch]" id="agency_branch">
						           <option value="">请选择</option>
                				<?php foreach($agency_branch as $key=>$value){?>
                				    <option value='<?=$key?>'<?php if($data['branch']==$key){echo 'selected';}?>><?=$value?></option>
                				<?php }?>
                				</select>
                		</td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_type')?>：</td>
						<td ><select  name="data[type]"  id="agency_type">
						           <option value="">请选择</option>
                				<?php foreach($agency_type as $key=>$value){?>
                				    <option value='<?=$key?>'<?php if($data['type']==$key){echo 'selected';}?>><?=$value?></option>
                				<?php }?>
                				</select></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_contact_teacher')?>：</td>
						<td ><input type="text" id="contact_teacher" class="input-text"
									name="data[contact_teacher]"   value="<?= isset($data['contact_teacher'])?$data['contact_teacher']:""?>"  /></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_contact_tel')?>：</td>
						<td ><input type="text" id="contact_tel" class="input-text"
									name="data[contact_tel]"  value="<?= isset($data['contact_tel'])?$data['contact_tel']:""?>"   /><span id="ctel_reminder" style="color: red;display:none;">联系方式输入有误，请重新输入！</span></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_sign_website')?>：</td>
						<td ><input type="text" id="sign_website" class="input-text"
									name="data[sign_website]"   value="<?= isset($data['sign_website'])?$data['sign_website']:""?>"  /><span id="ssite_reminder" style="color: red;display:none;">请按照：http://www.qq.com 格式输入！</span></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_sign_tel')?>：</td>
						<td ><input type="text" id="sign_tel" class="input-text"
									name="data[sign_tel]"   value="<?= isset($data['sign_tel'])?$data['sign_tel']:""?>"   /><span id="stel_reminder" style="color: red;display:none;">联系方式输入有误，请重新输入！</span></td>
					</tr>
					<tr>
					<tr>
						<td width="120"><?php echo L($column.'_image_horizontal')?>：</td>

						<td><?php echo form::images('data[image_horizontal]', 'image_horizontal', isset($data['image_horizontal'])?$data['image_horizontal']:"", 'agency', '', 40)?></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_image_vertical')?>：</td>

						<td><?php echo form::images('data[image_vertical]', 'image_vertical', isset($data['image_vertical'])?$data['image_vertical']:"", 'agency', '', 40)?></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_image_square')?>：</td>

						<td><?php echo form::images('data[image_square]', 'image_square',  isset($data['image_square'])?$data['image_square']:"", 'agency', '', 40)?></td>
					</tr>
					<tr>
						<td width="120"><?php echo L($column.'_description')?>：</td>
						<td><textarea name="data[description]" id="description"><?php if(isset($data['description']) ) { echo $data['description'];}?></textarea><?php echo form::editor('description','full','','','',1,1,'',800,300)?></td>
					</tr>
				</table>
			</fieldset>

		</div>
		<div class="bk15"></div>
		<?php if(ROUTE_M != 'information'){?>
		<input name="dosubmit" type="submit" id="dosubmit"
			value="<?php echo L('submit')?>" class="button">
		<?php }?>

	</form>

</div>
</body>
</html>